<template>
  <div class="hm-floor">

    <hm-floor v-if="comment.parent" :comment="comment.parent"></hm-floor>

    <!-- 内容部分 -->
    <div class="main">
      <div class="title">
        <div class="name">{{ comment.user.nickname }}</div>
        <div class="time">{{ comment.create_date | time('YYYY-MM-DD HH:mm:ss')}}</div>
        <div class="reply" @click="reply(comment.id, comment.user.nickname)">回复</div>
      </div>
      <div class="content">{{ comment.content }}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'hm-floor',
  props: {
    comment: Object,
    index: Number
  },
  methods: {
    reply (id, nickname) {
      this.$emit('reply', id, nickname)
    }
  }
}
</script>

<style lang="scss" scoped>
.hm-floor {
  .main {
    background-color: #eee;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    .title {
      display: flex;
      align-items: flex-end;
      .name {
        font-size: 14px;
      }
      .time {
        flex: 1;
        color: #888;
        margin-left: 10px;
      }
    }
  }
}
</style>
